package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.Role;
import com.itheima.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @description:
 * @author: LuoXuhuan
 * @date: 2020/10/28-20:58
 * @Version: 1.0.0
 */
@RestController
@RequestMapping("/role")
@Slf4j
public class RoleController {

    @Reference
    RoleService roleService;

    /**
     * 查询所有的角色
     * @return
     */
    @RequestMapping("/findRole")
    public Result findRole(){

        log.debug("role============获得信息!!!!");
        List<Role> role = roleService.findRole();
//        Object[] roles = role.toArray();
        log.debug("role============"+role);

        return new Result(true,"查询成功",role);
    }
}